<?php
     echo <<<endHTML
<html>
<head><title>Race night Horse naming</title></head>
<body bgcolor = "black">
<center> <FONT color="yellow"  SIZE=5> <b>
Race card entry confirmation Page <br>
<FONT Color="White">
If Any DataBase errors appear here Return to the Horse entry Page and enter the Race again<br>
Please ensure you do not use any grammatical symbols. <br>
 
 <Font color="Yellow"> 
endHTML;
$rn = $_POST['Race'] ;
 #$Hnum = $_POST['horse_num'];
$Hname1 = $_POST['horse_name1'];
$Hname2 = $_POST['horse_name2'];
$Hname3 = $_POST['horse_name3'];
$Hname4 = $_POST['horse_name4'];
$Hname5 = $_POST['horse_name5'];
$Hname6 = $_POST['horse_name6'];
$Hname7 = $_POST['horse_name7'];
$Hname8 = $_POST['horse_name8'];
$Hname9 = $_POST['horse_name9'];
$name_es = sqlite_escape_string($name);
#  echo  $Hname7 . $rn;
#if (!empty($hname)) {


   $dbhandle = sqlite_open('horse.db', 0666, $error);

   #if (!$dbhandle) die ($error);
  #$rnn ='race'.$rn  ;
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname1' WHERE horse_num = 1");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname2' WHERE horse_num = 2");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname3' WHERE horse_num = 3");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname4' WHERE horse_num = 4");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname5' WHERE horse_num = 5");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname6' WHERE horse_num = 6");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname7' WHERE horse_num = 7");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname8' WHERE horse_num = 8");
  sqlite_query($dbhandle, "UPDATE $rn SET horse_name ='$Hname9' WHERE horse_num = 9");
   #$ok = sqlite_query($dbhandle, $stm, $error);
    #echo $stm;
   #if (!$ok) die("Error: $error");  
   #echo "Race Number:- <br>";  
   echo $rn        ;
   echo "<br> Race Name <br> " ;
   echo $Hname9 ;
       #    echo $Hnum;
echo <<<endHTML
<html>
<head><title>Race has been updated</title></head>
<body>
<center>
   <br>
The horse names have updated </b> <br> <br>
Return to the horse entry Page >>
<a href="horseadd.html"> click here</a> <BR>
Goto the main tote input page  >>
<a href="Tote.php"> click here</a> <BR>   </font>
endHTML;


?>
